package com.woniuxy.microsysserver.service.impl;
import com.woniuxy.microsysserver.dao.CouponDao;
import com.woniuxy.microsysserver.dao.MemberCouponDao;
import com.woniuxy.microsysserver.entity.CouponEntity;
import com.woniuxy.microsysserver.entity.MemberCouponEntity;
import com.woniuxy.microsysserver.service.CouponService;
import com.woniuxy.microsysserver.service.MemberCouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Auther: wuson  <br/>
 * Date: 2021/3/11:19:51  <br/>
 * Description:
 */
@Service
public class MemberCouponServiceImpl implements MemberCouponService {
    @Autowired(required = false)
    private MemberCouponDao memberCouponDao;


    @Override
    public int getcoupon(String username, List<Integer> currentCouponIds) {
        int state = memberCouponDao.getcoupon(username,currentCouponIds);
        return state;
    }

    @Override
    public List<MemberCouponEntity> getcouponByUsername(String username) {
        List<MemberCouponEntity> memberCouponEntities = memberCouponDao.getcouponByUsername(username);
        return memberCouponEntities;
    }

    @Override
    public List<MemberCouponEntity> selectUsedCouponByUsername(String username) {
        List<MemberCouponEntity> memberCouponEntities = memberCouponDao.selectUsedCouponByUsername(username);
        return memberCouponEntities;
    }

    @Override
    public MemberCouponEntity getOneById(Integer couponId) {
        MemberCouponEntity memberCouponEntity  = memberCouponDao.getOneById(couponId);
        return memberCouponEntity;
    }

    @Override
    public String getHostAndPort() {
        String url=memberCouponDao.getHostAndPort();
        return url;
    }

    @Override
    public int updateHostAndPort(String url) {
        return memberCouponDao.updateHostAndPort(url);
    }
}
